<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script src="../lib/vue.js"></script>
    <div id="app">
      <p :class="str">111</p>
      <p class="init" :class="str">222</p>
      <hr />
      <h2>对象表示法</h2>
      <p :class="{active:isactive}">333</p>
      <p :class="{active:isactive,c:ixy}">444</p>
      <p :class="styleObject">555</p>
      <hr />
      <h2>数组表示法</h2>
      <p :class="[a,b]">666</p>
      <p :class="[isactive==true?c:'',d]">777</p>
      <p :class="[{e:isactive},f]"></p>
    </div>
    <script>
      let vm = new Vue({
        el: '#app',
        data: {
          str: 'abc',
          isactive: false,
          ixy: true,
          styleObject: {
            active: true,
            c: 'abc'.length >= 3,
            d: false,
          },
          a: 'mmm',
          b: 'zzz',
          c: 'iii',
          d: 'uuu',
          e: 'eee',
          f: 'fff',
        },
      })
    </script>
  </body>
</html>
